package com.bumptech.glide.request;

import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.engine.Resource;

/**
 * A callback that listens for when a resource load completes successfully or fails due to an
 * exception.
 * <p>
 * 当资源加载成功或因异常加载失败时的回调接口类
 * <p>
 * 唯一实现类为{@link SingleRequest}
 */
public interface ResourceCallback {

    /**
     * Called when a resource is successfully loaded.
     * <p>
     * 资源加载成功时被调用
     *
     * @param resource The loaded resource.
     */
    void onResourceReady(Resource<?> resource, DataSource dataSource);

    /**
     * Called when a resource fails to load successfully.
     *
     * @param e a non-null {@link GlideException}.
     */
    void onLoadFailed(GlideException e);
}
